﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QLNHASACH.PresentationLayer.SearchCtrl.Sach
{
    public partial class ItemSach : UserControl
    {
        public ItemSach()
        {
            InitializeComponent();
            lbTenSach.GotFocus += new EventHandler(lbTenSach_GotFocus);
            lbTenSach.LostFocus += new EventHandler(lbTenSach_LostFocus);
        }
        public delegate void sukien(Object sender);
        public event sukien Clik;
        void lbTenSach_LostFocus(object sender, EventArgs e)
        {
            this.BackColor = SystemColors.Control;
        }

        void lbTenSach_GotFocus(object sender, EventArgs e)
        {
            this.BackColor = Color.GreenYellow;  
        }
        public string TenSach
        {
            get
            {
                return lbTenSach.Text;
            }
            set
            {
                lbTenSach.Text = value;
            }
        }
        public string TacGia
        {
            get
            {
                return lbTacGia.Text;
            }
            set
            {
                lbTacGia.Text = value;
            }
        }
        public string TheLoai
        {
            get
            {
                return lbTheLoai.Text;
            }
            set
            {
                lbTheLoai.Text = value;
            }
        }
        public string NhaXuatBan
        {
            get
            {
                return lbNhaXuatBan.Text;
            }
            set
            {
                lbNhaXuatBan.Text = value;
            }
        }
        public string NamXB
        {
            get
            {
                return lbNamXB.Text;
            }
            set
            {
                lbNamXB.Text = value;
            }
        }
        public void SetData(DataRow row)
        {
            TenSach = row[1].ToString();
            TheLoai = row[2].ToString();
            TacGia = row[3].ToString();
            NhaXuatBan = row[4].ToString();
            NamXB = row[5].ToString();
        }

        private void lbTenSach_Click(object sender, EventArgs e)
        {
            if (Clik != null)
                Clik(this);
        }
        private void ItemSach_MouseEnter(object sender, EventArgs e)
        {
            lbTenSach.Focus();
        }
    }
}
